<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="description" content="" />
        <meta name="keywords" content="" />
        <meta name="author" content="Flying hormone" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta charset="UTF-8">
        <link rel="stylesheet" href="../css/media.css" />
        <link rel="stylesheet" href="../css/mui.min.css" />
        <link rel="stylesheet" href="../css/head_foot.css" />
        <script type="text/javascript" src="../js/jquery-1.9.1.js"></script>
        <script type="text/javascript" src="../js/jquery.Query.js" ></script>
        <script type="text/javascript" src="../js/jquery-cookie.js"></script>
        <script type="text/javascript" src="../js/mui.min.js"></script>
        <script type="text/javascript" src="../js/appcan.js"></script>
        <script type="text/javascript" src="../js/appcan.control.js"></script>
        <script type="text/javascript" src="../js/common.js" ></script>
		<title>我的模版</title>
		<style>
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
                -moz-box-sizing: border-box;
                -webkit-box-sizing: border-box;
            }
            
            body {
                width: 100%;
                overflow-x: hidden;
                font-family: "微软雅黑";
                background: #f8f8f8;
                font-size: 1em;
                padding-bottom: 3.875em;
            }
            
            h1,
            h2,
            h3,
            h4,
            h5,
            h6 {
                font-weight: normal;
                margin: 0;
            }
            
            i{
                font-style: normal; color: #f2a605;
            }
            
            a{
                color: #FF3366;
            }
            
            p {
                margin: 0;
                text-indent: 2em;
                background: #fff;
                font-size: 0.7em;
                line-height: 3.125em;
                color: #999;
            }
            
            
            section{ margin-bottom: 0.625em;}
            section a{ height:1.4em; line-height:1.2em; font-size:0.8em; border: 1px solid #ff3366; padding: 0 0.3125em; border-radius: 0.3125em; float: right; margin-top: 1.1em; margin-right: 0.3125em;}
            section h3{ float: left; font-size: 0.8em; line-height: 3.75em; text-indent: 1em;}
            section div{ position: relative; height: 3em; border-bottom: 1px solid #929292; overflow: hidden; background: #fff;}
            section  span.mui-icon{ display: none; position: absolute; top: 0.625em; right: 0.625em; color: #0173bd;font-size: 1.5em;}
            .shengcheng i{ margin-right: 0.3125em;}
        </style>
	</head>

	<body>
		<header>
			<a><span class="leftleft"></span></a>
			<h1>我的模版</h1>
		</header>
		<section class="jieshou"  id="myReceive">
			<div>
				<h3>已接受的模版</h3>
				<a class="editInfo">模版使用</a>
                <a class="yulan">预览</a>
                <a class="shanchu1">删除</a>
			</div>
		</section>
		
		<section class="shengcheng" id="myMoban">
			<div>
				<h3>我生成的模版</h3>
				<a class="editInfo">模版使用</a>
				<a class="yulan">预览</a>
				<a class="shanchu2">删除</a>
			</div>
		</section>
		<footer>
			<nav class="mui-bar mui-bar-tab">
				<a href="javascript:;" id="tcIndex">
                    <img src="../img/shouye2.png" />
                    <span class="mui-tab-label">首页</span>
                </a>
                <a href="javascript:;" id="myfabu">
                    <img src="../img/fabu2.png" />
                    <span class="mui-tab-label">发布</span>
                </a>
                <a class="action" href="javascript:;" id="myInfo">
                    <img src="../img/mine2.png" />
                    <span class="mui-tab-label">我的</span>
                </a>
			</nav>
		</footer>
<script>
    var actId = "";
    var type = "";
    var msgId = "";
	$(document).ready(function(){
	    $(".shanchu1").click(function(){
            if(!!!msgId){
                alert("请选择");
                return false;
            }
            $.ajax({
                type:"post",
                url:host+"/delUserMsg.json?msgId="+msgId,
                dataType:"json",
                success : function(dataResult) {
                    window.location.reload();
                }
            })
        })
        $(".shanchu2").click(function(){
            if(!!!actId){
                alert("请选择");
                return false;
            }
            $.ajax({
                type:"post",
                url:host+"/delAct.json?actId="+actId,
                dataType:"json",
                success : function(dataResult) {
                    window.location.reload();
                }
            })
        })
        
	    $(".editInfo").click(function(){
            if(!!!actId){
                alert("请选择");
                return false;
            }
            openUrl("moban_shengcheng.html?actId="+actId+"&type="+type,"moban_shengcheng");
        })
        
        $(".yulan").click(function(){
            if(!!!actId){
                alert("请选择");
                return false;
            }
            openUrl("../page/info.html?actId="+actId,"actInfo");
        })
        
		//推荐的模板
        $.ajax({
            type:"post",
            async:false,       
            url:host+"/getUserMsgList.json?userId="+appcan.locStorage.getVal("userId")+"&msgType=2",
            data:"",
            dataType:"json",
            contentType: "application/json",
            success : function(dataResult) {
                var dataList = dataResult.data;
                var mymobanstr = ""; 
                if(dataList.length>0){
                    for(var i=0;i<dataList.length;i++){
                        mymobanstr +='<div data-id="'+(dataList[i].createBy || '')+'" data-msgId="'+(dataList[i].id || '')+'">';
                        mymobanstr +='<p>'+dataList[i].content+'</p>';
                        mymobanstr +='<span class="mui-icon mui-icon-checkmarkempty"></span>';
                        mymobanstr +='</div>';
                    }
                }
                $("#myReceive").append(mymobanstr);
                $("section div").click(function(){
                    if($(this).find("span").css("display") == "block"){
                        $(this).find("span").hide();
                        actId = "";
                        type = "";
                        msgId = "";
                    }else{
                        $("section div span").hide();
                        $(this).find("span").attr("display","block");
                        actId = $(this).attr("data-id");
                        type = "";
                        msgId =$(this).attr("data-msgId");
                    }
                });
            }
        })
		//我生成的模板
        $.ajax({
            type:"post",
            async:false,       
            url:host+"/getMyActList.json?userId="+appcan.locStorage.getVal("userId"),
            data:"",
            dataType:"json",
            contentType: "application/json",
            success : function(dataResult) {
                var dataList = dataResult.data;
                if(dataList.length>0){
                    var mymobanstr = ""; 
                    for(var i=0;i<dataList.length;i++){
                        mymobanstr +='<div data-type="'+dataList[i].actType+'" data-id="'+dataList[i].id+'">';
                        mymobanstr +='<p><i>'+dataList[i].actName+'</i>   '+dataList[i].createTime+'  设计</p>';
                        mymobanstr +='<span class="mui-icon mui-icon-checkmarkempty"></span>';
                        mymobanstr +='</div>';
                    }
                    $("#myMoban").append(mymobanstr);
                    $("section div").click(function(){
                        if($(this).find("span").css("display") == "block"){
                            $(this).find("span").hide();
                            actId = "";
                            type = "";
                        }else{
                            $("section div span").hide();
                            $(this).find("span").show();
                            actId = $(this).attr("data-id");
                            type = $(this).attr("data-type");
                        }
                    });
                }
            }
        })
	});
</script>
	</body>

</html>